//
//  HttpLoginAction.m
//  HKXProject
//
//  Created by wucha on 2017/10/10.
//  Copyright © 2017年 fc. All rights reserved.
//

#import "HttpLoginAction.h"

@implementation HttpLoginAction

#pragma mark- 登录
+(void)postLoginInfoWithLoginAction:(LoginActionInfo*)loginActionInfo finish:(HTTPResultBlock)block{
    NSString *requestString = [Utils getUrlWithAction:ActionLogin parmasAndKeys: nil];
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setObject:loginActionInfo.username forKey:@"phone"];
    if ([loginActionInfo.loginMethod isEqualToString:@"BY_PHONE"]) {
        [params setObject:loginActionInfo.password forKey:@"password"];

    }else{
        [params setObject:loginActionInfo.password forKey:@"smsCode"];

    }
    [params setObject:loginActionInfo.loginMethod forKey:@"loginMethod"];

    [self postRequestWithRequest:requestString withParam:params jsonSelector:@selector(getLoginResultWithResponseData:) finish:block];
}
/*
#pragma mark- 注册
+(void)postRegisterInfoWithRegisterAction:(RegisterActionInfo*)registerActionInfo finish:(HTTPResultBlock)block{
    NSString *requestString = [Utils getUrlWithAction:ActionRegister parmasAndKeys:nil];
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setObject:registerActionInfo.phone forKey:@"phone"];
    [params setObject:registerActionInfo.passwd forKey:@"passwd"];
    [params setObject:registerActionInfo.verifyCode forKey:@"verifyCode"];
    [params setObject:registerActionInfo.inviteCode forKey:@"inviteCode"];
    [self postRequestWithRequest:requestString withParam:params jsonSelector:@selector(getRegisterResultWithResponseData:) finish:block];


}

#pragma mark- 创建账户
+(void)postCreateAccountInfoWithAccountAction:(AccountActionInfo*)accountActionInfo finish:(HTTPResultBlock)block{
    NSString *requestString = [Utils getUrlWithAction:ActionCreateAccount parmasAndKeys: nil];
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setObject:accountActionInfo.realName forKey:@"realName"];
    [params setObject:accountActionInfo.province forKey:@"province"];
    [params setObject:accountActionInfo.city forKey:@"city"];
    [params setObject:accountActionInfo.bankName forKey:@"bankName"];
    [params setObject:accountActionInfo.bankCard forKey:@"bankCard"];
    [params setObject:accountActionInfo.agentName forKey:@"agentName"];
    [params setObject:accountActionInfo.idNo forKey:@"idNo"];
    [params setObject:accountActionInfo.paymentPasswd forKey:@"paymentPasswd"];

    [self postRequestWithRequest:requestString withParam:params jsonSelector:@selector(getCreateAccountResultWithResponseData:) finish:block];
}*/

#pragma mark- 发送短信
+(void)getSendSMSInfoWithSMSAction:(SMSActionInfo*)smsActionInfo finish:(HTTPResultBlock)block{
    NSString *requestString = [Utils getUrlWithAction:ActionSendSMS parmasAndKeys:smsActionInfo.mobile,@"mobile" ,smsActionInfo.module,@"module",nil];
//    [self requestWithRequest:requestString jsonParserSelector:@selector(getSendSMSResultWithResponseData:) finish:block];
//    NSMutableDictionary *params = [NSMutableDictionary dictionary];
//    [params setObject:smsActionInfo.mobile forKey:@"mobile"];
//    [params setObject:smsActionInfo.module forKey:@"module"];
    [self postRequestWithRequest:requestString withParam:nil jsonSelector:@selector(getSendSMSResultWithResponseData:) finish:block];

}

//#pragma mark- 密码修改
//+(void)postRestPasswordInfo:(NSString*)phone withCode:(NSString*)code password:(NSString*)password finish:(HTTPResultBlock)block{
//    NSString *requestString = [Utils getUrlWithAction:ActionResetPassword parmasAndKeys: nil];
//    NSMutableDictionary *params = [NSMutableDictionary dictionary];
//    [params setObject:code forKey:@"verifyCode"];
//    [params setObject:password forKey:@"newPassword"];
//    [params setObject:phone forKey:@"phone"];
//    [self postRequestWithRequest:requestString withParam:params jsonSelector:@selector(getRestPasswordInfoResultWithResponseData:) finish:block];
//
//
//}
//
+(void)postLogOut:(HTTPResultBlock)block{
    NSString *requestString = [Utils getUrlWithAction:ActionLogOut parmasAndKeys: nil];
    [self postRequestWithRequest:requestString withParam:nil jsonSelector:@selector(getLogOutInfoResultWithResponseData:) finish:block];


}

+(void)getUserInfo:(HTTPResultBlock)block{
    NSString *requestString = [Utils getUrlWithAction:ActionUserInfo parmasAndKeys: nil];
    [self requestWithRequest:requestString jsonParserSelector:@selector(getUserInfoResultWithResponseData:) finish:block];
}


@end
